package com.sky.demo.proxy.dynamicproxy;

import com.sky.demo.proxy.staticproxy.IRentingHouse;
import com.sky.demo.proxy.staticproxy.IRentingHouseImp;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * Description:
 * Cglib动态代理
 *
 * @author Sky
 * @Date 2021/7/31 14:39
 */
public class CglibProxy {
    public static void main(String[] args) {

        // 委托对象 委托方
        IRentingHouse rentingHouse = new IRentingHouseImp();

        IRentingHouse cglibProxy = (IRentingHouse) ProxyFactory.INSTANCE.getCglibProxy(rentingHouse);

        cglibProxy.rentHouse();

    }
}
